<!DOCTYPE html>
<html lang="en">
<head>    
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- 表达式的意思 -->
        <h1>{{message}}</h1>
        <img v-bind:src="url" alt="">
        <img :src="url" alt="">
        <button v-on:click= "sayHi">测试按钮</button>
        <button @click= "sayHi">测试按钮</button>
        <button @click= "changImg">改变图片</button>
    </div>
    <h1>hello world</h1>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <script>
        // 创建vue实例
        // dom思路： 先获取dom， 再操作节点。 document.querySelector()
        new Vue({
            //  选项
            el:"#app",
            data:{
                message: "hello VUE",
                url: "img/2.png"
            },
            methods:{
                sayHi(){
                    alert("HI")
                },
                changImg(){
                    
                    this.url = "img/1.png"
                }
            }
        })
    </script>
</body>
</html>